\(\int \frac {d+\frac {e}{x}}{c+\frac {a}{x^2}+\frac {b}{x}} \, dx\) [35]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [F(-2)]
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 22, antiderivative size = 86 \[ \int \frac {d+\frac {e}{x}}{c+\frac {a}{x^2}+\frac {b}{x}} \, dx=\frac {d x}{c}-\frac {\left (b^2 d-2 a c d-b c e\right ) \text {arctanh}\left (\frac {b+2 c x}{\sqrt {b^2-4 a c}}\right )}{c^2 \sqrt {b^2-4 a c}}-\frac {(b d-c e) \log \left (a+b x+c x^2\right )}{2 c^2} \]

[Out]

d*x/c-1/2*(b*d-c*e)*ln(c*x^2+b*x+a)/c^2-(-2*a*c*d+b^2*d-b*c*e)*arctanh((2*c*x+b)/(-4*a*c+b^2)^(1/2))/c^2/(-4*a
*c+b^2)^(1/2)

Rubi [A] (verified)

Time = 0.05 (sec) , antiderivative size = 86, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.273, Rules used = {1407, 787, 648, 632, 212, 642} \[ \int \frac {d+\frac {e}{x}}{c+\frac {a}{x^2}+\frac {b}{x}} \, dx=-\frac {\text {arctanh}\left (\frac {b+2 c x}{\sqrt {b^2-4 a c}}\right ) \left (-2 a c d+b^2 d-b c e\right )}{c^2 \sqrt {b^2-4 a c}}-\frac {(b d-c e) \log \left (a+b x+c x^2\right )}{2 c^2}+\frac {d x}{c} \]

[In]

Int[(d + e/x)/(c + a/x^2 + b/x),x]

[Out]

(d*x)/c - ((b^2*d - 2*a*c*d - b*c*e)*ArcTanh[(b + 2*c*x)/Sqrt[b^2 - 4*a*c]])/(c^2*Sqrt[b^2 - 4*a*c]) - ((b*d -
 c*e)*Log[a + b*x + c*x^2])/(2*c^2)

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 632

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 642

Int[((d_) + (e_.)*(x_))/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Simp[d*(Log[RemoveContent[a + b*x +
c*x^2, x]]/b), x] /; FreeQ[{a, b, c, d, e}, x] && EqQ[2*c*d - b*e, 0]

Rule 648

Int[((d_.) + (e_.)*(x_))/((a_) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Dist[(2*c*d - b*e)/(2*c), Int[1/(a +
 b*x + c*x^2), x], x] + Dist[e/(2*c), Int[(b + 2*c*x)/(a + b*x + c*x^2), x], x] /; FreeQ[{a, b, c, d, e}, x] &
& NeQ[2*c*d - b*e, 0] && NeQ[b^2 - 4*a*c, 0] &&  !NiceSqrtQ[b^2 - 4*a*c]

Rule 787

Int[(((d_.) + (e_.)*(x_))*((f_) + (g_.)*(x_)))/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Simp[e*g*(x/c
), x] + Dist[1/c, Int[(c*d*f - a*e*g + (c*e*f + c*d*g - b*e*g)*x)/(a + b*x + c*x^2), x], x] /; FreeQ[{a, b, c,
 d, e, f, g}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 1407

Int[((a_) + (c_.)*(x_)^(n2_.) + (b_.)*(x_)^(n_))^(p_.)*((d_) + (e_.)*(x_)^(n_))^(q_.), x_Symbol] :> Int[x^(n*(
2*p + q))*(e + d/x^n)^q*(c + b/x^n + a/x^(2*n))^p, x] /; FreeQ[{a, b, c, d, e, n}, x] && EqQ[n2, 2*n] && Integ
ersQ[p, q] && NegQ[n]

Rubi steps \begin{align*} \text {integral}& = \int \frac {x (e+d x)}{a+b x+c x^2} \, dx \\ & = \frac {d x}{c}+\frac {\int \frac {-a d+(-b d+c e) x}{a+b x+c x^2} \, dx}{c} \\ & = \frac {d x}{c}-\frac {(b d-c e) \int \frac {b+2 c x}{a+b x+c x^2} \, dx}{2 c^2}+\frac {\left (b^2 d-2 a c d-b c e\right ) \int \frac {1}{a+b x+c x^2} \, dx}{2 c^2} \\ & = \frac {d x}{c}-\frac {(b d-c e) \log \left (a+b x+c x^2\right )}{2 c^2}-\frac {\left (b^2 d-2 a c d-b c e\right ) \text {Subst}\left (\int \frac {1}{b^2-4 a c-x^2} \, dx,x,b+2 c x\right )}{c^2} \\ & = \frac {d x}{c}-\frac {\left (b^2 d-2 a c d-b c e\right ) \tanh ^{-1}\left (\frac {b+2 c x}{\sqrt {b^2-4 a c}}\right )}{c^2 \sqrt {b^2-4 a c}}-\frac {(b d-c e) \log \left (a+b x+c x^2\right )}{2 c^2} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.06 (sec) , antiderivative size = 86, normalized size of antiderivative = 1.00 \[ \int \frac {d+\frac {e}{x}}{c+\frac {a}{x^2}+\frac {b}{x}} \, dx=\frac {2 c d x+\frac {2 \left (b^2 d-2 a c d-b c e\right ) \arctan \left (\frac {b+2 c x}{\sqrt {-b^2+4 a c}}\right )}{\sqrt {-b^2+4 a c}}+(-b d+c e) \log (a+x (b+c x))}{2 c^2} \]

[In]

Integrate[(d + e/x)/(c + a/x^2 + b/x),x]

[Out]

(2*c*d*x + (2*(b^2*d - 2*a*c*d - b*c*e)*ArcTan[(b + 2*c*x)/Sqrt[-b^2 + 4*a*c]])/Sqrt[-b^2 + 4*a*c] + (-(b*d) +
 c*e)*Log[a + x*(b + c*x)])/(2*c^2)

Maple [A] (verified)

Time = 0.12 (sec) , antiderivative size = 90, normalized size of antiderivative = 1.05

method result size
default \(\frac {d x}{c}+\frac {\frac {\left (-b d +e c \right ) \ln \left (c \,x^{2}+b x +a \right )}{2 c}+\frac {2 \left (-d a -\frac {\left (-b d +e c \right ) b}{2 c}\right ) \arctan \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}}}{c}\) \(90\)
risch \(\text {Expression too large to display}\) \(1357\)

[In]

int((d+e/x)/(c+a/x^2+b/x),x,method=_RETURNVERBOSE)

[Out]

d*x/c+1/c*(1/2*(-b*d+c*e)/c*ln(c*x^2+b*x+a)+2*(-d*a-1/2*(-b*d+c*e)*b/c)/(4*a*c-b^2)^(1/2)*arctan((2*c*x+b)/(4*
a*c-b^2)^(1/2)))

Fricas [A] (verification not implemented)

none

Time = 0.31 (sec) , antiderivative size = 291, normalized size of antiderivative = 3.38 \[ \int \frac {d+\frac {e}{x}}{c+\frac {a}{x^2}+\frac {b}{x}} \, dx=\left [\frac {2 \, {\left (b^{2} c - 4 \, a c^{2}\right )} d x + {\left (b c e - {\left (b^{2} - 2 \, a c\right )} d\right )} \sqrt {b^{2} - 4 \, a c} \log \left (\frac {2 \, c^{2} x^{2} + 2 \, b c x + b^{2} - 2 \, a c + \sqrt {b^{2} - 4 \, a c} {\left (2 \, c x + b\right )}}{c x^{2} + b x + a}\right ) - {\left ({\left (b^{3} - 4 \, a b c\right )} d - {\left (b^{2} c - 4 \, a c^{2}\right )} e\right )} \log \left (c x^{2} + b x + a\right )}{2 \, {\left (b^{2} c^{2} - 4 \, a c^{3}\right )}}, \frac {2 \, {\left (b^{2} c - 4 \, a c^{2}\right )} d x + 2 \, {\left (b c e - {\left (b^{2} - 2 \, a c\right )} d\right )} \sqrt {-b^{2} + 4 \, a c} \arctan \left (-\frac {\sqrt {-b^{2} + 4 \, a c} {\left (2 \, c x + b\right )}}{b^{2} - 4 \, a c}\right ) - {\left ({\left (b^{3} - 4 \, a b c\right )} d - {\left (b^{2} c - 4 \, a c^{2}\right )} e\right )} \log \left (c x^{2} + b x + a\right )}{2 \, {\left (b^{2} c^{2} - 4 \, a c^{3}\right )}}\right ] \]

[In]

integrate((d+e/x)/(c+a/x^2+b/x),x, algorithm="fricas")

[Out]

[1/2*(2*(b^2*c - 4*a*c^2)*d*x + (b*c*e - (b^2 - 2*a*c)*d)*sqrt(b^2 - 4*a*c)*log((2*c^2*x^2 + 2*b*c*x + b^2 - 2
*a*c + sqrt(b^2 - 4*a*c)*(2*c*x + b))/(c*x^2 + b*x + a)) - ((b^3 - 4*a*b*c)*d - (b^2*c - 4*a*c^2)*e)*log(c*x^2
 + b*x + a))/(b^2*c^2 - 4*a*c^3), 1/2*(2*(b^2*c - 4*a*c^2)*d*x + 2*(b*c*e - (b^2 - 2*a*c)*d)*sqrt(-b^2 + 4*a*c
)*arctan(-sqrt(-b^2 + 4*a*c)*(2*c*x + b)/(b^2 - 4*a*c)) - ((b^3 - 4*a*b*c)*d - (b^2*c - 4*a*c^2)*e)*log(c*x^2
+ b*x + a))/(b^2*c^2 - 4*a*c^3)]

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 423 vs. \(2 (82) = 164\).

Time = 0.71 (sec) , antiderivative size = 423, normalized size of antiderivative = 4.92 \[ \int \frac {d+\frac {e}{x}}{c+\frac {a}{x^2}+\frac {b}{x}} \, dx=\left (- \frac {\sqrt {- 4 a c + b^{2}} \cdot \left (2 a c d - b^{2} d + b c e\right )}{2 c^{2} \cdot \left (4 a c - b^{2}\right )} - \frac {b d - c e}{2 c^{2}}\right ) \log {\left (x + \frac {- a b d - 4 a c^{2} \left (- \frac {\sqrt {- 4 a c + b^{2}} \cdot \left (2 a c d - b^{2} d + b c e\right )}{2 c^{2} \cdot \left (4 a c - b^{2}\right )} - \frac {b d - c e}{2 c^{2}}\right ) + 2 a c e + b^{2} c \left (- \frac {\sqrt {- 4 a c + b^{2}} \cdot \left (2 a c d - b^{2} d + b c e\right )}{2 c^{2} \cdot \left (4 a c - b^{2}\right )} - \frac {b d - c e}{2 c^{2}}\right )}{2 a c d - b^{2} d + b c e} \right )} + \left (\frac {\sqrt {- 4 a c + b^{2}} \cdot \left (2 a c d - b^{2} d + b c e\right )}{2 c^{2} \cdot \left (4 a c - b^{2}\right )} - \frac {b d - c e}{2 c^{2}}\right ) \log {\left (x + \frac {- a b d - 4 a c^{2} \left (\frac {\sqrt {- 4 a c + b^{2}} \cdot \left (2 a c d - b^{2} d + b c e\right )}{2 c^{2} \cdot \left (4 a c - b^{2}\right )} - \frac {b d - c e}{2 c^{2}}\right ) + 2 a c e + b^{2} c \left (\frac {\sqrt {- 4 a c + b^{2}} \cdot \left (2 a c d - b^{2} d + b c e\right )}{2 c^{2} \cdot \left (4 a c - b^{2}\right )} - \frac {b d - c e}{2 c^{2}}\right )}{2 a c d - b^{2} d + b c e} \right )} + \frac {d x}{c} \]

[In]

integrate((d+e/x)/(c+a/x**2+b/x),x)

[Out]

(-sqrt(-4*a*c + b**2)*(2*a*c*d - b**2*d + b*c*e)/(2*c**2*(4*a*c - b**2)) - (b*d - c*e)/(2*c**2))*log(x + (-a*b
*d - 4*a*c**2*(-sqrt(-4*a*c + b**2)*(2*a*c*d - b**2*d + b*c*e)/(2*c**2*(4*a*c - b**2)) - (b*d - c*e)/(2*c**2))
 + 2*a*c*e + b**2*c*(-sqrt(-4*a*c + b**2)*(2*a*c*d - b**2*d + b*c*e)/(2*c**2*(4*a*c - b**2)) - (b*d - c*e)/(2*
c**2)))/(2*a*c*d - b**2*d + b*c*e)) + (sqrt(-4*a*c + b**2)*(2*a*c*d - b**2*d + b*c*e)/(2*c**2*(4*a*c - b**2))
- (b*d - c*e)/(2*c**2))*log(x + (-a*b*d - 4*a*c**2*(sqrt(-4*a*c + b**2)*(2*a*c*d - b**2*d + b*c*e)/(2*c**2*(4*
a*c - b**2)) - (b*d - c*e)/(2*c**2)) + 2*a*c*e + b**2*c*(sqrt(-4*a*c + b**2)*(2*a*c*d - b**2*d + b*c*e)/(2*c**
2*(4*a*c - b**2)) - (b*d - c*e)/(2*c**2)))/(2*a*c*d - b**2*d + b*c*e)) + d*x/c

Maxima [F(-2)]

Exception generated. \[ \int \frac {d+\frac {e}{x}}{c+\frac {a}{x^2}+\frac {b}{x}} \, dx=\text {Exception raised: ValueError} \]

[In]

integrate((d+e/x)/(c+a/x^2+b/x),x, algorithm="maxima")

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(4*a*c-b^2>0)', see `assume?` f
or more deta

Giac [A] (verification not implemented)

none

Time = 0.38 (sec) , antiderivative size = 83, normalized size of antiderivative = 0.97 \[ \int \frac {d+\frac {e}{x}}{c+\frac {a}{x^2}+\frac {b}{x}} \, dx=\frac {d x}{c} - \frac {{\left (b d - c e\right )} \log \left (c x^{2} + b x + a\right )}{2 \, c^{2}} + \frac {{\left (b^{2} d - 2 \, a c d - b c e\right )} \arctan \left (\frac {2 \, c x + b}{\sqrt {-b^{2} + 4 \, a c}}\right )}{\sqrt {-b^{2} + 4 \, a c} c^{2}} \]

[In]

integrate((d+e/x)/(c+a/x^2+b/x),x, algorithm="giac")

[Out]

d*x/c - 1/2*(b*d - c*e)*log(c*x^2 + b*x + a)/c^2 + (b^2*d - 2*a*c*d - b*c*e)*arctan((2*c*x + b)/sqrt(-b^2 + 4*
a*c))/(sqrt(-b^2 + 4*a*c)*c^2)

Mupad [B] (verification not implemented)

Time = 0.13 (sec) , antiderivative size = 127, normalized size of antiderivative = 1.48 \[ \int \frac {d+\frac {e}{x}}{c+\frac {a}{x^2}+\frac {b}{x}} \, dx=\frac {\ln \left (c\,x^2+b\,x+a\right )\,\left (d\,b^3-e\,b^2\,c-4\,a\,d\,b\,c+4\,a\,e\,c^2\right )}{2\,\left (4\,a\,c^3-b^2\,c^2\right )}+\frac {d\,x}{c}-\frac {\mathrm {atan}\left (\frac {b}{\sqrt {4\,a\,c-b^2}}+\frac {2\,c\,x}{\sqrt {4\,a\,c-b^2}}\right )\,\left (-d\,b^2+c\,e\,b+2\,a\,c\,d\right )}{c^2\,\sqrt {4\,a\,c-b^2}} \]

[In]

int((d + e/x)/(c + a/x^2 + b/x),x)

[Out]

(log(a + b*x + c*x^2)*(b^3*d + 4*a*c^2*e - b^2*c*e - 4*a*b*c*d))/(2*(4*a*c^3 - b^2*c^2)) + (d*x)/c - (atan(b/(
4*a*c - b^2)^(1/2) + (2*c*x)/(4*a*c - b^2)^(1/2))*(2*a*c*d - b^2*d + b*c*e))/(c^2*(4*a*c - b^2)^(1/2))